package com.shaoshaohuo.app.view.citymenu.entity;

import android.os.Parcel;
import android.os.Parcelable;

import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;


/**
 * 此类为省、市、区县UI组件，需要的数据项。代替了旧版本中的City、Province等类
 * @CreateBy  YinSF	2016-01-05
 */
@Table(name="Area", onCreated = "CREATE UNIQUE INDEX tmet_area_index_name ON Area(areaId )")
public class Area implements Parcelable {
	public static final Creator<Area> CREATOR = new Creator<Area>() {

		@Override
		public Area createFromParcel(Parcel source) {
			return new Area(source);
		}

		@Override
		public Area[] newArray(int size) {
			return new Area[size];
		}

	};
	@Column(name="id", isId = true)
	private int id; //此Id为业务无关ID,只用于本地数据库存储。
	@Column(name="areaId")
	private String areaId; //业务id
	@Column(name="name")
	private String name; //名称
	@Column(name="parentAreaId")
	private String parentAreaId; //父级id
	@Column(name="lng")
	private String lng; //纬度
	@Column(name="lat")
	private String lat; //经度
	@Column(name="levelType")
	private String levelType; //等级  省：1 ； 市：2 ； 区县：3 ；
	public Area() {
		super();
	}
	public Area(Parcel source) {
		id = source.readInt();
		areaId = source.readString();
		name = source.readString();
		parentAreaId = source.readString();
		lng = source.readString();
		lat = source.readString();
		levelType = source.readString();
	}

	public String getAreaId() {
		return areaId;
	}

	public void setAreaId(String areaId) {
		this.areaId = areaId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public String getParentAreaId() {
		return parentAreaId;
	}

	public void setParentAreaId(String parentAreaId) {
		this.parentAreaId = parentAreaId;
	}

	public String getLng() {
		return lng;
	}

	public void setLng(String lng) {
		this.lng = lng;
	}

	public String getLat() {
		return lat;
	}

	public void setLat(String lat) {
		this.lat = lat;
	}

	public String getLevelType() {
		return levelType;
	}

	public void setLevelType(String levelType) {
		this.levelType = levelType;
	}

	@Override
	public String toString() {
		return "Area [areaId=" + areaId + ", name=" + name + ", parentAreaId=" + parentAreaId
				+ "]";
	}

	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}

	@Override
	public int describeContents() {
		return 0;
	}
	
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(id);
		dest.writeString(areaId);
		dest.writeString(name);
		dest.writeString(parentAreaId);
		dest.writeString(lng);
		dest.writeString(lat);
		dest.writeString(levelType);
	}
}
